<template>
	<view class="record">
		<!-- #ifdef APP-PLUS -->
		<Hearder :name="'门票记录'" v-if="type==1"></Hearder>
		<Hearder :name="'充值记录'" v-if="type==2"></Hearder>
		<Hearder :name="'积分明细'" v-if="type==3"></Hearder>
		<Hearder :name="'提现记录'" v-if="type==4 || type==5"></Hearder>
		<Hearder :name="ptbname" v-if="type==6"></Hearder>
		<!-- #endif -->
		<view class="list-con">
			<u-transition :show="show">
				<view class="every" v-if="loading" v-for="item in 3">
					<view style="width: 100%;">
						<u-skeleton
							rows="2"
							:title="false"
							:loading="loading"
							:rowsWidth="['100%','100%']"
							:rowsHeight="['50rpx','50rpx']"
							animate>
						</u-skeleton>
					</view>
				</view>
				<view class="every" v-if="!loading" v-for="item in list">
					<view>
						<view>{{item.remark}}</view>
						<view>{{item.create_time}}</view>
					</view>
					<view>{{item.amount}}</view>
				</view>
				<view class="nidata" v-if="list.length==0&&!loading">
					<image src="../../static/images/noimg.png"></image>
				</view>
			</u-transition>
		</view>
	</view>
</template>

<script>
	export default {
		data(){
			return{
				list:[],
				type:1, //1交易记录  2充值记录 3积分明细
				page:1,
				last_page:1,
				ptbname:'',
				show:true,
				loading:true,
			}
		},
		onLoad(options) {
			this.type = options.type
			if(this.type==2){
				uni.setNavigationBarTitle({
				　　title: '充值记录'
				})
			}else if(this.type==3){
				uni.setNavigationBarTitle({
				　　title: '积分明细'
				})
			}else if(this.type==4 || this.type==5){
				uni.setNavigationBarTitle({
				　　title: '提现记录'
				})
			}else if(this.type==6){
				this.ptbname = options.ptbname + '记录'
				uni.setNavigationBarTitle({
				　　title: options.ptbname+'记录'
				})
			}
			this.getinit()
		},
		onReachBottom(){
			this.page = this.page + 1
			if (this.page <= this.last_page) {
				this.getinit()
			}
		},
		methods:{
			getinit(){
				if(this.type==1){
					this.request('/token/tokenList',{page:this.page}).then(res=>{
						if(res.data.code == 1){
							this.list = this.list.concat(res.data.data.data)
							this.last_page = res.data.data.last_page
						}
						this.loading = false;
					})
				}else if(this.type==2){
					this.request('/member/profitDetail',{page:this.page,limit:10,type:1}).then(res=>{
						if(res.data.code == 1){
							this.list = this.list.concat(res.data.data.data)
							this.last_page = res.data.data.last_page
						}
						this.loading = false;
					})
				}else if(this.type==3){
					this.request('/member/getIntegralList').then(res=>{
						if(res.data.code == 1){
							this.list = res.data.data.list
						}
						this.loading = false;
					})
				}else if(this.type==4 || this.type==5){
					this.request('/member/getWithdrawalList',{type:this.type}).then(res => {
						if(res.data.code==1){
							this.list = res.data.data.data
						}
						this.loading = false;
					})
				}else if(this.type==6){
					this.request('/member/getFinanceList',{page:this.page,page_size:10,type:0}).then(res => {
						if(res.data.code==1){
							this.list = this.list.concat(res.data.data.list)
							this.last_page = res.data.data.last_page
						}
						this.loading = false;
					})
				}
			}
		}
	}
</script>

<style scoped lang="scss">
	.record{
		.list-con{
			margin: 0 3%;
			.every{
				width:100%;
				display: flex;
				justify-content: space-between;
				align-items: center;
				padding: 30rpx 0;
				border-bottom: 1rpx solid $uni-background-color;
				>view{
					&:first-of-type{
						width: 80%;
					}
					&:last-of-type{
						font-size: 38rpx;
						color: #00B478;
					}
					view{
						&:first-of-type{
							font-size: 28rpx;
						}
						&:last-of-type{
							font-size: 24rpx;
							color: #999;
							margin-top: 12rpx;
						}
					}
				}
			}
		}
	}
</style>